package com.flower.ApiGateway.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.flower.ApiGateway.entity.HttpResponseBean;
import com.flower.ApiGateway.entity.LoginEntity;
import com.flower.ApiGateway.entity.OpenPlatformEntity;
import com.flower.ApiGateway.service.UserService;

/**  

* <p>Title: AuthController</p>  

* <p>Description:用户认证控制器 </p>  

* @author QingFeng  

* @date 2019年5月29日  

*/  
@RestController
@RequestMapping(value ="/auth")
public class AuthController {
	@Autowired
	private UserService userService;

	/**   
	 * @Title: loginAuth   
	 * @Description: 用于用户登录认证  用于带密码的用户身份验证
	 * @param: @param entity
	 * @param: @return      
	 * @return: HttpResponseBean      
	 * @throws   
	 */
	@RequestMapping(value ="/login", method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public HttpResponseBean  loginAuth(@RequestBody LoginEntity entity ) {
		
		return userService.login(entity);
	}
	
	/**  
	
	 * <p>Title: loginAuth</p>  
	
	 * <p>Description: 来自开放平台的用户登录系统</p>  
	
	 * @param entity
	 * @return  
	
	 */  
	@RequestMapping(value ="/loginForOpen", method = RequestMethod.POST, produces="application/json;charset=UTF-8")
	public HttpResponseBean  loginAuth(@RequestBody OpenPlatformEntity entity ) {
		
		return userService.OpenPlatformlogin(entity);
	}

}
